/**
 * Created with IntelliJ IDEA.
 * Description :
 * User: $ {USER}
 * Date: $ {YEAR}-$ {MONTH}一$ { DAY}
 * Time: ${ TIME}
 */

/**
 * java入门级书Hello First中的题目
 * 感悟：原来与main方法所在的类可以不加public访问修饰限定符
 * Java语法只规定了一个.java文件中只能有一个类被public修饰，并没有规定一定要由public修饰
 */
/*
class DrumKit {
    boolean topHat = true;
    boolean snare = true;
    void playSnare() {
        System.out.println("bang bang ba-bang");
    }
    void playTopHat() {
        System.out.println("ding ding da-ding");
    }
}
class Test {
    public static void main(String [] args) {

        DrumKit d = new DrumKit();
        d.playSnare();
        d.playTopHat();
        d.snare = false;
        if (d.snare == true) {
            d.playSnare();
        }
    }
}*/


/*
public class Test {
    public static void main(String [] args) {
        Echo e1 = new Echo();
        Echo e2 = new Echo( ); //正确答案
        //Echo.e2 = e1; // 也可以
        int x = 0;
        while ( x < 4 ) {
            e1.hello();
            e1.count = e1.count + 1;
            if ( x == 3 ) {
                e2.count = e2.count + 1;
            }
            if ( x > 0 ) {
                e2.count = e2.count + e1.count;
            }
            x = x + 1;
        }
        System.out.println(e2.count);
    }
}
class Echo {
    int count = 0;
    void hello( ) {
        System.out.println("helloooo... ");
    }
}*/



/*
public class Test {
    public static void main(String [] args) {
        Echo e1 = new Echo();
        //Echo e2 = new Echo( ); //正确答案
        Echo e2 = e1; // 也可以
        int x = 0;
        while ( x < 4 ) {
            e1.hello();
            e1.count = e1.count + 1;
            if ( x == 3 ) {
                e2.count = e2.count + 1;
            }
            if ( x > 0 ) {
                e2.count = e2.count + e1.count;
            }
            x = x + 1;
        }
        System.out.println(e2.count);
    }
}
class Echo {
    int count = 0;
    void hello( ) {
        System.out.println("helloooo... ");
    }
}*/

/**
 * 等号（=）两边一定要注意类型相同，否则就会报错（在没有强制类型转换时）
 * 但是隐式类型转换就不会发生错误
 */
/*public class Test{
    public static void main(String[] args){
        int x = 24;
        //Byte y = x; ——> Java中对类型检查很严谨
        //byte y = 129;  超出byte的范围了
        //Byte y = 144;  超出byte的范围了

         *//*int x = 34.5;
         boolean boo = x;
         int g = 17;
         int y = g;
         y = y + 10;
         short s;
         s = y;
         byte b = 3;
         byte v = b;
         short n = 12;
         v = n;
         byte k = 128;
         int p = 3 * g + y;*//*
    }
}*/


/*
public class Test{
       public static void main(String[] args){
           Dog dog = new Dog();
       }
}

class Animol{
    public String name;
    public int age;
    public Animol(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("父类构造方法");
    }
    {
        System.out.println("父类实例代码块");
    }
    static{
        System.out.println("父类静态代码块");
    }

}

class Dog  extends Animol{
    public String character;
    public Dog(){
        super("huahua",5);
        System.out.println("子类的构造方法");
    }
    {
        System.out.println("子类的实例代码块");
    }
    static{
        System.out.println("子类的静态代码块");
    }
}*/
